package com.tongda.core.utils;

import java.util.ArrayList;
import java.util.List;

import com.tongda.core.repository.MenuDishDao;
import com.tongda.core.vo.DishesCategory;

import android.content.Context;

public class DishCategoryUtil {

	private static DishCategoryUtil instance;
	private MenuDishDao dish_dao;

	public DishCategoryUtil(Context context) {
		dish_dao = MenuDishDao.getInstance(context);
	}

	public static synchronized DishCategoryUtil getInstance(Context context) {
		if (instance == null) {
			instance = new DishCategoryUtil(context);
		}
		return instance;
	}

	public List<DishesCategory> init4DishesCategory() {
		List<DishesCategory> dishesCategories = new ArrayList<DishesCategory>();

		// 增加“全部”分类
		DishesCategory dcAll = new DishesCategory();
		dcAll.setCategoryName("全部");
		dcAll.setCategoryId("all");
		dishesCategories.add(dcAll);

		DishesCategory dc1 = new DishesCategory();
		dc1.setCategoryName("招牌菜");
		dc1.setCategoryId("zpc");
		if (dish_dao.get4Dishes("isSpecialty").size() > 0) {
			dishesCategories.add(dc1);
		}
		DishesCategory dc2 = new DishesCategory();
		dc2.setCategoryName("推荐菜");
		dc2.setCategoryId("tjc");
		if (dish_dao.get4Dishes("isRecommend").size() > 0) {
			dishesCategories.add(dc2);
		}
		DishesCategory dc3 = new DishesCategory();
		dc3.setCategoryName("特价菜肴");
		dc3.setCategoryId("tjcy");
		if (dish_dao.get4Dishes("specialPrice").size() > 0) {
			dishesCategories.add(dc3);
		}
		DishesCategory dc4 = new DishesCategory();
		dc4.setCategoryName("会员特价");
		dc4.setCategoryId("hytj");
		if (dish_dao.get4Dishes("memberPrice").size() > 0) {
			dishesCategories.add(dc4);
		}
		return dishesCategories;
	}
}
